package p270jp;

import p243io.reactivex.exceptions.CompositeException;
import p244ip.Response;
import p418pd.RxJavaPlugins;
import p436q6.StringMerger;
import p593wc.AbstractC6902j;
import p593wc.AbstractC6903n;
import p671zc.Disposable;
import retrofit2.adapter.rxjava2.HttpException;

/* renamed from: jp.a */
/* loaded from: classes2.dex */
public final class BodyObservable<T> extends AbstractC6902j<T> {

    /* renamed from: a */
    public final AbstractC6902j<Response<T>> f18262a;

    /* compiled from: BodyObservable.java */
    /* renamed from: jp.a$a */
    /* loaded from: classes2.dex */
    public static class C3978a<R> implements AbstractC6903n<Response<R>> {

        /* renamed from: a */
        public final AbstractC6903n<? super R> f18263a;

        /* renamed from: b */
        public boolean f18264b;

        public C3978a(AbstractC6903n<? super R> nVar) {
            this.f18263a = nVar;
        }

        /* renamed from: a */
        public void mo305g(Response<R> zVar) {
            if (zVar.m5092a()) {
                this.f18263a.mo305g((R) zVar.f17708b);
                return;
            }
            this.f18264b = true;
            HttpException httpException = new HttpException(zVar);
            try {
                this.f18263a.mo307b(httpException);
            } catch (Throwable th) {
                StringMerger.m2841u(th);
                RxJavaPlugins.m3026b(new CompositeException(httpException, th));
            }
        }

        @Override // p593wc.AbstractC6903n
        /* renamed from: b */
        public void mo307b(Throwable th) {
            if (!this.f18264b) {
                this.f18263a.mo307b(th);
                return;
            }
            AssertionError assertionError = new AssertionError("This should never happen! Report as a bug with the full stacktrace.");
            assertionError.initCause(th);
            RxJavaPlugins.m3026b(assertionError);
        }

        @Override // p593wc.AbstractC6903n
        /* renamed from: c */
        public void mo306c(Disposable bVar) {
            this.f18263a.mo306c(bVar);
        }

        @Override // p593wc.AbstractC6903n
        public void onComplete() {
            if (!this.f18264b) {
                this.f18263a.onComplete();
            }
        }
    }

    public BodyObservable(AbstractC6902j<Response<T>> jVar) {
        this.f18262a = jVar;
    }

    @Override // p593wc.AbstractC6902j
    /* renamed from: r */
    public void mo983r(AbstractC6903n<? super T> nVar) {
        this.f18262a.mo979a(new C3978a(nVar));
    }
}
